package yunjiao.designpatterns.builder;

/**
 * TODO
 *
 * @author yangyunjiao
 */
public record User(String email,
                   String username,
                   String firstName,
                   String lastName,
                   String displayName) {

    public static class Builder {
        private String email, username, firstName, lastName, displayName;

        public static Builder user() {
            return new Builder();
        }

        public Builder email(String email) {
            this.email = email;
            return this;
        }

        public Builder username(String username) {
            this.username = username;
            return this;
        }

        public Builder firstName(String firstName) {
            this.firstName = firstName;
            return this;
        }

        public Builder lastName(String lastName) {
            this.lastName = lastName;
            return this;
        }

        public Builder displayName(String displayName) {
            this.displayName = displayName;
            return this;
        }

        public User build() {
            return new User(email, username, firstName, lastName, displayName);
        }
    }
}
